using UnityEngine;
using System.Collections;

public class MenuScript : MonoBehaviour {


	private int selection = 0;
	public Texture fleche;

	// Use this for initialization
	void Start () {
	
	}

	void OnGUI()
	{



		GUI.Box(new Rect(Screen.width * 0.5f - 150, Screen.height * 0.5f - 100, 300, 100), "");
		GUILayout.BeginArea(new Rect(Screen.width * 0.5f - 150, Screen.height * 0.5f - 100, 300, 100));

		GUILayout.BeginVertical();

		GUILayout.TextArea("New Game", 100);
		GUILayout.TextArea("LeaderBoard", 100);
		GUILayout.TextArea("Quit", 100);

		GUILayout.EndVertical();

		GUILayout.EndArea();

		if (selection == 0)
		{
			GUI.DrawTexture(new Rect(Screen.width * 0.5f - 170, Screen.height * 0.5f - 100, 20, 20), fleche, ScaleMode.ScaleAndCrop, false, 1);
		}
		else if (selection == 1)
		{
			GUI.DrawTexture(new Rect(Screen.width * 0.5f - 170, Screen.height * 0.5f - 75, 20, 20), fleche, ScaleMode.ScaleAndCrop, false, 1);
		}
		else if (selection == 2)
		{
			GUI.DrawTexture(new Rect(Screen.width * 0.5f - 170, Screen.height * 0.5f - 50, 20, 20), fleche, ScaleMode.ScaleAndCrop, false, 1);
		}

	}
	
	// Update is called once per frame
	void Update () {
		if (Input.GetKeyDown("down") && selection < 2)
		{
			selection ++;
		}

		if (Input.GetKeyDown("up") && selection > 0)
		{
			selection--;
		}

		if (Input.GetKeyDown("return") && selection == 0)
		{
			Application.LoadLevel(1);
		}
		else if (Input.GetKeyDown("return") && selection == 1)
		{
			Application.LoadLevel(2);
		}
		else if (Input.GetKeyDown("return") && selection == 2)
		{
			Application.Quit();
		}

	}
}
